//
// Created by WuShiHai on 23/11/2016.
//

#include <stdio.h>
#include <arpa/inet.h>

int main(int argc,char *argv[]){
    unsigned short host_post = 0x1234;
    unsigned short net_post;
    unsigned long host_addr = 0x12345678;
    unsigned long net_addr;

    net_post = htons(host_post);
    net_addr = htonl(host_addr);

    printf("Host ordered post: %#x \n",host_post);
    printf("Network ordered post: %#x \n",net_post);
    printf("Host ordered address: %#lx \n",host_addr);
    printf("Network ordered address: %#lx \n",net_addr);

    return 0;

}